﻿using MVC.OA.IDAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace MVC.OA.DALFactory
{
   public partial class StaticDALFactory
    {
        public static string assembly = System.Configuration.ConfigurationManager.AppSettings["DALAssemblyName"];
        //public static IUserInfoDAL GetUserInfoDAL()
        //{

        //    //return new YaJiLing.OA.NHDAL.UserInfoDal();//简单工厂
        //    //通过程序集名称来变换数据库访问层，这里将变化的程序集名称提取出从配置文件获取
        //    //return  Assembly.Load("YaJiLing.OA.NHDAL").CreateInstance("UserInfoDal") as IUserInfoDal;
        //    //升级

        //    //缓存优化
        //    //IUserInfoDal uiDal = HttpRuntime.Cache.Get("UserInfoDal") as IUserInfoDal;
        //    //if (uiDal == null)
        //    //{
        //    //    uiDal = Assembly.Load(assembly).CreateInstance(assembly + ".UserInfoDal") as IUserInfoDal;
        //    //    HttpRuntime.Cache.Add();
        //    //}
        //    return Assembly.Load(assembly).CreateInstance(assembly + ".UserInfoDAL") as IUserInfoDAL;
        //}
        //public static IOrderInfoDAL GetOrderInfoDAL()
        //{
        //    return Assembly.Load(assembly).CreateInstance(assembly + ".OrderInfoDAL") as IOrderInfoDAL;
        //}
                 
    }
}
